package com.taobao.action.ui;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;

import com.taobao.action.CommonAction;
import com.taobao.ui.widget.CommonWidget;

public class MouseRightAction implements MouseListener {

	private CommonAction action;

	private CommonWidget commonWidget;

	private Object sourceObject;

	public MouseRightAction(CommonAction action, CommonWidget commonWidget, Object sourceObject) {
		this.action = action;
		this.commonWidget = commonWidget;
		this.sourceObject = sourceObject;
	}

	@Override
	public void mouseDoubleClick(MouseEvent e) {
	}

	@Override
	public void mouseDown(MouseEvent e) {
		if (e.button == 3) {
			action.setData("source", sourceObject);
			action.setData("e", e);
			action.doAction(commonWidget);
		}
	}

	@Override
	public void mouseUp(MouseEvent e) {

	}

}
